Skip to content

Conversation

@svozza
Copy link
Contributor

@svozza svozza commented Oct 20, 2025

Summary

This PR adds support for using an async context (specifically from the InvokeStore package) in the Logger utility. This allows users to emit log statements that are isolated specifically to the current lambda invocation, isolated from any other executions.

Changes

  • Added a specific storage class for log attributes: LogAttributesStore
  • The Logger class only accesses the data in this store through this interface and never touches the stored objects directly.
  • Updated all methods that stored log attributes and log keys to use the new storage class.
  • The storage class checks whether it is running in the InvokeStore context: if they are then the log keys are stored in the current async context, otherwise we fallback to a plain instance wide object as per the current implementation.
  • Moved the sequence testing function to the common testing package.
  • Added specific concurrency tests to ensure isolation is working as intended for the LogAttributesStore and theLogger class as a whole.

Issue number: closes #4667


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@svozza svozza requested a review from sdangol October 20, 2025 20:25
@svozza svozza self-assigned this Oct 20, 2025
@pull-request-size pull-request-size bot added the size/XXL PRs with 1K+ LOC, largely documentation related label Oct 20, 2025
@boring-cyborg boring-cyborg bot added logger This item relates to the Logger Utility tests PRs that add or change tests labels Oct 20, 2025
@svozza svozza force-pushed the async-local-storage-logger branch 2 times, most recently from 2073078 to c128331 Compare October 20, 2025 22:51
sdangol
sdangol previously approved these changes Oct 22, 2025
Copy link
Contributor

@sdangol sdangol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small question. Rest looks good from my side.

@svozza svozza requested a review from sdangol October 22, 2025 23:22
@boring-cyborg boring-cyborg bot added the dependencies Changes that touch dependencies, e.g. Dependabot, etc. label Oct 23, 2025
@svozza svozza added the do-not-merge This item should not be merged label Oct 23, 2025
@svozza svozza marked this pull request as draft October 23, 2025 15:48
@svozza svozza force-pushed the async-local-storage-logger branch from 4a1a3a9 to 3c9ac2f Compare October 28, 2025 23:12
@svozza svozza removed the do-not-merge This item should not be merged label Oct 28, 2025
@svozza svozza marked this pull request as ready for review October 28, 2025 23:13
@sonarqubecloud
Copy link

@svozza svozza merged commit 4507fcc into main Oct 28, 2025
40 checks passed
@svozza svozza deleted the async-local-storage-logger branch October 28, 2025 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Changes that touch dependencies, e.g. Dependabot, etc. logger This item relates to the Logger Utility size/XXL PRs with 1K+ LOC, largely documentation related tests PRs that add or change tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: Allow use of InvokeStore in Logger

2 participants